﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Nox.Amuse.MVVM;

namespace Nox.Amuse.View
{
    /// <summary>
    /// Interaction logic for SimpleWorldExplorer.xaml
    /// </summary>
    public partial class SimpleWorldExplorer : Window
    {
        public SimpleWorldExplorer()
        {
            InitializeComponent();
            App.Messenger.Register<ObservableObject>(Messages.CloseDialog, (o => { CloseRequested(o); }));
            this.Activated += new EventHandler(SimpleWorldExplorer_Activated);
        }

        private void CloseRequested(ObservableObject o)
        {
            if (o == this.DataContext)
                this.Close();
        }

        void SimpleWorldExplorer_Activated(object sender, EventArgs e)
        {
            this.CorrectWindowPosition();
            this.Activated -= new EventHandler(SimpleWorldExplorer_Activated);
        }
    }
}
